package main

import (
	"context"
	"fmt"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"grpc_learn/gen-proto/user"
	"log"
)

const address = "127.0.0.1:50001"

func main() {
	dial, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
	defer dial.Close()
	if err != nil {
		log.Fatalln(fmt.Sprintf("连接%s失败！！！", address))
	}
	client := user.NewUserClient(dial)
	list, err := client.GetUser(context.Background(), &user.UserRequest{Name: "李四"})
	fmt.Println(list)
}
